package com.hoshiibuy.sys.permission.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hoshiibuy.common.aop.Logable;
import com.hoshiibuy.common.rpc.Response;
import com.hoshiibuy.sys.permission.dao.SysUserRoleMapper;
import com.hoshiibuy.sys.permission.entity.SysUserRole;
import com.hoshiibuy.sys.permission.service.ISysUserRoleService;

/**
 * <p>
 * 用户角色关联表 服务实现类
 * </p>
 *
 * @author Mr.Wu
 * @since 2019-04-18
 */
@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {

	@Autowired
	private SysUserRoleMapper sysUserRoleMapper;

	@Override
	@Cacheable(cacheNames = "sysUserRole", key = "T(com.hoshiibuy.common.utils.DigestUtils).md5(Wrapper(SqlSelect=' + #queryWrapper.getSqlSelect() + ', SqlSegment=' + #queryWrapper.getSqlSegment() + ')')")
	@Logable(authName = "权限相关-用户角色管理-分页查询用户拥有角色信息")
	public Response<List<SysUserRole>> getSysUserRoleList(Wrapper<SysUserRole> queryWrapper) {
		return Response.data(sysUserRoleMapper.selectList(queryWrapper));
	}

}
